<style type="text/css">
.new_cart th.remove {
	width: 10px;
}
.new_cart th {
	border-bottom-width: 1px;
	border-bottom-style: solid;
	border-bottom-color: #999;
}
.new_cart th small {
	display:block;
	font-weight:normal;
}
.new_cart {
	margin-top: 10px;
	margin-right: auto;
	margin-left: auto;
}
.new_cart .total_divider {
	border-top-width: 1px;
	border-top-style: solid;
	border-top-color: #9D9D9D;
	padding: 0px;
	font-size: 0px;
	line-height: 0px;
}
.new_cart  td , .new_cart th{
	padding: 5px;
	vertical-align: top;
}
.sumval td {
	background-color: #F3F3F3;
}
.new_cart .qty_controller {
	display: block;
	overflow: hidden;
	width: 52px;
	margin-right: auto;
	margin-left: auto;
}
.new_cart .qty_input {
	width: 30px;
	text-align: center;
	border: 1px inset #CCC;
	padding: 2px;
	height: 20px;
	float: left;
}
.new_cart .qtyincdec {
	display: inline-block;
	width: 12px;
	float: right;
}
.new_cart .qtyincdec a {
	display: block;
	background-color: #7c7c7c;
	text-decoration: none;
	border: 1px solid #686868;
	width: 10px;
	height: 10px;
	overflow: hidden;
	text-indent: -99999px;
	background-position: center center;
	background-repeat: no-repeat;
}
.new_cart .qtyincdec a:hover {
	border: 1px solid #232323;
	background-color: #515151;
}
.new_cart .qtyincdec a.incrs {
	background-image: url(images/qty_inc.gif);
	margin-bottom: 1px;
}
.new_cart .qtyincdec a.decrs {
	background-image: url(images/qty_dec.gif);
	margin-top: 1px;
}
.new_cart .remove_item_btn {
	display: block;
	height: 16px;
	width: 16px;
	text-indent: -99999px;
	background-image: url(http://tempscratchy2335.e-nitiative.eu/template/images/icons/cart_remove_itm.png);
}
.new_cart .item td {
	border-top-width: 1px;
	border-right-width: 1px;
	border-top-style: solid;
	border-right-style: dashed;
	border-top-color: #CCC;
	border-right-color: #EEE;
}
.new_cart .item td.lst {
	border-right:none;
}
.new_cart tr.item:hover td {
	border-top-width: 1px;
	border-top-style: solid;
	border-top-color: #CCC;
	background-color: #A6FBFF;
}
.new_cart .total_amount {
	font-size: 14px;
	font-weight: bold;
}
.new_cart .total_wout_vat_amount {
	font-weight: bold;
}
.new_cart .total_amount .amount {
	border-top-width: 3px;
	border-top-style: double;
	border-top-color: #888;
}
.new_cart .total_amount .lbl {
	border-top-width: 3px;
	border-top-style: double;
	border-top-color: transparent;
}
.new_cart .cart_actions_col {
	background-color: #E5E5E5;
	padding: 10px;
	border-top-width: 1px;
	border-top-style: solid;
	border-top-color: #C7C7C7;
}
.new_cart .cart_actions .checkout {
	background-color: #676767;
	color: #FFF;
	text-decoration: none;
	display: block;
	padding-top: 5px;
	padding-right: 10px;
	padding-bottom: 5px;
	padding-left: 10px;
	font-weight: bold;
	font-size: 13px;
}

.new_cart .item_tax_info th, .new_cart .item_tax_info td {
	padding: 2px;
	border:none !important;
	font-weight:normal;
	text-align:right;
}
.new_cart .item_tax_info .total_tax_amount td, .new_cart .item_tax_info .total_tax_amount th{
	font-weight: bold;
	border-top-width: 1px;
	border-top-style: solid;
	border-top-color: #CCC;
}
</style>
<h2>Shopping Cart</h2>
<?php
if(count($cart_arr) > 0)
{
?>
<div id="msg_box4" style="display: none;"></div>
<div class="new_cart">
<table width="100%" id="cart_table" border="0" cellspacing="0" cellpadding="0">
	<tr>
		 <th   align="left" class="desc" scope="col">Item Dsc </th>
                 <th align="center" class="partnumber" scope="col">Item Code</th>
		 <th align="right" class="unit_price" scope="col">Unit Price(LKR)</th>
		<th class="qty" scope="col">Quantity</th>
		<th align="right" class="unit_price" scope="col">Total(LKR)</th>
		 <th width="1%" class="remove" scope="col">&nbsp;</th>
	</tr>

<?php
	$tot = "";
	
	foreach ($cart_arr as $cart_entry) :
		$unit_price = $cart_entry['price'];
		$qty = $cart_entry['quantity'];
		$subtotal = $cart_entry['SUBTOTAL'];
?>    		
		<div id="msgbox" style="display: none;"></div>     						
		<tr class="item">
			<td><?php echo $cart_entry['product_title']; ?></td>
                        <td align="center"><?php echo $cart_entry['item_code']; ?> </td>
			<td align="center"><?php echo number_format($cart_entry['price'], 2, '.', ','); ?></td>
			<td align="center"><input type="text" name="txtQty" id="txtQty" value="<?php echo $qty; ?>" maxlength="5" size="2" onkeyup="updateQty('<?php echo $cart_entry['product_id']; ?>', this.value, '')" class="quantity" /></td>
			<td align="right">
				<?php
					$item_price = $unit_price * $qty;
					$price = number_format($item_price, 2, '.', ',');
					echo $price; //do not delete
					$tot = $tot + $item_price;
					$subtotal = number_format($tot, 2, '.', ',');						
				?>							
			</td>
			<td class="lst" align="center"><a href="javascript: void(0);" onclick="delCartItem('<?php echo $cart_entry['product_id']; ?>', '')"><img src="<?php echo SITEURL; ?>images/delete.png" alt="remove from cart" /></a></td>
		</tr>					
					                        
	<?php	
		endforeach;
	?>
	<tr class="total_wout_vat_amount sumval">
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td align="right" class="lbl" colspan="3">Sub Total</td>
		<td colspan="2" align="right" class="amount"><?php echo $subtotal; ?></td>
	</tr>
	<tr>
		<td colspan="4" align="right">&nbsp;</td>
	</tr>
        <?php if($creditbalance<$tot && strlen($_SESSION["user_id"]>0)):?>
        <tr>
            <td colspan="4" align="right"><font color="red"><strong>You have exceeded your credit limit. Your credit limit is LKR  :<?php echo number_format($creditbalance, 2, '.', ','); ?></strong></font></td>
	</tr>
        <?php endif;?>
</table>
<table width="98%" border="0" cellpadding="2" cellspacing="1">
	<tr>
		<td align="left" colspan="2">&nbsp;</td>
	</tr>
	<tr>
		<td align="left" colspan="2">
			<?php /*
				if(isset($_SESSION['user_id']))
				{
					$modSaveCart->savecart();
				}*/
			?>
		</td>
	</tr>	
	<tr>
		<td align="left" colspan="2">&nbsp;</td>
	</tr>
	<tr>
		<td  colspan="10" class="cart_actions_col"><a href="<?php echo SITEURL; ?>index.php/?products">Continue on shopping</a></td>
		<td class="cart_actions_col" align="right"><a href="<?php echo SITEURL; ?>index.php/?checkout">Proceed to checkout</a></td>
	</tr>
</table>
</div>
<?php
} else {
	echo "<span class='error'>Your cart is empty.</span> <br /><br /><span class='txt_size10'><a href='" . SITEURL . "index.php/?products'>Continue on shopping</a></span>";
}
?>
